package com.java.controller;

import com.java.dao.ClosingCostDao;
import com.java.entity.ClosingCost;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;

/**
 * 结算费用(ClosingCost)表控制层
 *
 * @author 安能
 * @since 2020-07-01 11:26:54
 */
@RestController
@RequestMapping("ClosingCost")
public class ClosingCostController {



    @Resource
    private ClosingCostDao closingCostDao;




    @GetMapping("insert")
    public ClosingCost insert(ClosingCost closingCost) {
        closingCostDao.insert(closingCost);
        return closingCost;
    }

    @GetMapping("selectList")
    public HashMap<String, Object> selectList(Integer id) {

        List<ClosingCost> closingCost = closingCostDao.selectList(null);

        HashMap<String, Object> map = new HashMap<>();
        map.put("code", 0);
        map.put("msg", "");
        map.put("count", closingCost.size());
        map.put("data", closingCost);
        return map;
    }
}